# -*- coding: utf-8 -*-

"""
常量定义
"""

"""

版权所有 © 2025 金羿ELS
Copyright (c) 2025 Eilles(EillesWan@outlook.com)

MineMusicVisualizer is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
         http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.

"""


# =======================================================
# 指示性常量

CLT_ANSI = "COLOUR_TYPE_ANSI"
"""
颜色转义类型：ANSI 颜色代码
"""

CLT_MC = "COLOUR_TYPE_MINECRAFT"
"""
颜色转义类型：我的世界格式化字符串
"""


# =======================================================
# Midi 相关常量


MIDI_PITCH_GROUP = {
    0: "“大字三组”",
    12: "大字二组",
    24: "大字一组",
    36: "大字组",
    48: "小字组",
    60: "小字一组",
    72: "小字二组",
    84: "小字三组",
    96: "小字四组",
    108: "小字五组",
    120: "“小字六组”",
}
"""
按照钢琴键分组规律给音符编号的组
"""

# =======================================================
# 我的世界 相关常量


MINECRAFT_COLOUR_MAP = {
    "§0": {
        "NAME": ("纯黑", "black"),
        "RGB": ("0", "0", "0"),
        "HEX": "#000000",
        "BG_RGB": ["0", "0", "0"],
        "BG_HEX": "#000000",
        "BE_BLOCK": "minecraft:black_concrete",
    },
    "§1": {
        "NAME": ("湛蓝", "dark_blue"),
        "RGB": ("0", "0", "170"),
        "HEX": "#0000AA",
        "BG_RGB": ["0", "0", "42"],
        "BG_HEX": "#00002A",
        "BE_BLOCK": "minecraft:blue_concrete",
    },
    "§2": {
        "NAME": ("墨绿", "dark_green"),
        "RGB": ("0", "170", "0"),
        "HEX": "#00AA00",
        "BG_RGB": ["0", "42", "0"],
        "BG_HEX": "#002A00",
        "BE_BLOCK": "minecraft:green_concrete",
    },
    "§3": {
        "NAME": ("青绿", "dark_aqua"),
        "RGB": ("0", "170", "170"),
        "HEX": "#00AAAA",
        "BG_RGB": ["0", "42", "42"],
        "BG_HEX": "#002A2A",
        "BE_BLOCK": "minecraft:purple_concrete",  # 对不起，实际上 cyan wool 更适合
    },
    "§4": {
        "NAME": ("血红", "dark_red"),
        "RGB": ("170", "0", "0"),
        "HEX": "#AA0000",
        "BG_RGB": ["42", "0", "0"],
        "BG_HEX": "#2A0000",
        "BE_BLOCK": "minecraft:brown_concrete",
    },
    "§5": {
        "NAME": ("紫红", "dark_purple"),
        "RGB": ("170", "0", "170"),
        "HEX": "#AA00AA",
        "BG_RGB": ["42", "0", "42"],
        "BG_HEX": "#2A002A",
        "BE_BLOCK": "minecraft:magenta_concrete",
    },
    "§6": {
        "NAME": ("金橙", "gold"),
        "RGB": ("255", "170", "0"),
        "HEX": "#FFAA00",
        "BG_RGB": ["64", "42", "0"],
        "BG_HEX": "#402A00",
        "BE_BLOCK": "minecraft:orange_concrete",
    },
    "§7": {
        "NAME": ("浅灰", "gray"),
        "RGB": ("170", "170", "170"),
        "HEX": "#AAAAAA",
        "BG_RGB": ["42", "42", "42"],
        "BG_HEX": "#2A2A2A",
        "BE_BLOCK": "minecraft:light_gray_concrete",
    },
    "§8": {
        "NAME": ("沉灰", "dark_gray"),
        "RGB": ("85", "85", "85"),
        "HEX": "#555555",
        "BG_RGB": ["21", "21", "21"],
        "BG_HEX": "#151515",
        "BE_BLOCK": "minecraft:gray_concrete",
    },
    "§9": {
        "NAME": ("靛蓝", "blue"),
        "RGB": ("85", "85", "255"),
        "HEX": "#5555FF",
        "BG_RGB": ["21", "21", "63"],
        "BG_HEX": "#15153F",
        "BE_BLOCK": "minecraft:light_blue_concrete",
    },
    "§a": {
        "NAME": ("亮绿", "green"),
        "RGB": ("85", "255", "85"),
        "HEX": "#55FF55",
        "BG_RGB": ["21", "63", "21"],
        "BG_HEX": "#153F15",
        "BE_BLOCK": "minecraft:lime_concrete",
    },
    "§b": {
        "NAME": ("天青", "aqua"),
        "RGB": ("85", "255", "255"),
        "HEX": "#55FFFF",
        "BG_RGB": ["21", "63", "63"],
        "BG_HEX": "#153F3F",
        "BE_BLOCK": "minecraft:cyan_concrete",
    },
    "§c": {
        "NAME": ("亮红", "red"),
        "RGB": ("255", "85", "85"),
        "HEX": "#FF5555",
        "BG_RGB": ["63", "21", "21"],
        "BG_HEX": "#3F1515",
        "BE_BLOCK": "minecraft:red_concrete",
    },
    "§d": {
        "NAME": ("洋红", "light_purple"),
        "RGB": ("255", "85", "255"),
        "HEX": "#FF55FF",
        "BG_RGB": ["63", "21", "63"],
        "BG_HEX": "#3F153F",
        "BE_BLOCK": "minecraft:pink_concrete",
    },
    "§e": {
        "NAME": ("亮黄", "yellow"),
        "RGB": ("255", "255", "85"),
        "HEX": "#FFFF55",
        "BG_RGB": ["63", "63", "21"],
        "BG_HEX": "#3F3F15",
        "BE_BLOCK": "minecraft:yellow_concrete",
    },
    "§f": {
        "NAME": ("纯白", "white"),
        "RGB": ("255", "255", "255"),
        "HEX": "#FFFFFF",
        "BG_RGB": ["63", "63", "63"],
        "BG_HEX": "#3F3F3F",
        "BE_BLOCK": "minecraft:white_concrete",
    },
    # 从此开始，后是 Java 版不可用的格式化代码
    "§g": {
        "NAME": ("沙黄", "minecoin_gold"),
        "RGB": ("221", "214", "5"),
        "HEX": "#DDD605",
        "BG_RGB": ["55", "53", "1"],
        "BG_HEX": "#373501",
        "BE_BLOCK": "minecraft:smooth_sandstone",
    },
    "§h": {
        "NAME": ("石白", "material_quartz"),
        "RGB": ("227", "212", "209"),
        "HEX": "#E3D4D1",
        "BG_RGB": ["56", "53", "52"],
        "BG_HEX": "#383534",
        "BE_BLOCK": "minecraft:quartz_block",
    },
    "§i": {
        "NAME": ("铁银", "material_iron"),
        "RGB": ("206", "202", "202"),
        "HEX": "#CECACA",
        "BG_RGB": ["51", "50", "50"],
        "BG_HEX": "#333232",
        "BE_BLOCK": "minecraft:iron_block",
    },
    "§j": {
        "NAME": ("岩灰", "material_netherite"),
        "RGB": ("68", "58", "59"),
        "HEX": "#443A3B",
        "BG_RGB": ["17", "14", "14"],
        "BG_HEX": "#110E0E",
        "BE_BLOCK": "minecraft:netherite_block",
    },
    "§m": {
        "NAME": ("棕红", "material_redstone"),
        "RGB": ("151", "22", "7"),
        "HEX": "#971607",
        "BG_RGB": ["37", "5", "1"],
        "BG_HEX": "#250501",
        "BE_BLOCK": "minecraft:redstone_block",
    },
    "§n": {
        "NAME": ("铜棕", "material_copper"),
        "RGB": ("180", "104", "77"),
        "HEX": "#B4684D",
        "BG_RGB": ["45", "26", "19"],
        "BG_HEX": "#2D1A13",
        "BE_BLOCK": "minecraft:waxed_copper",
    },
    "§p": {
        "NAME": ("金黄", "material_gold"),
        "RGB": ("222", "177", "45"),
        "HEX": "#DEB12D",
        "BG_RGB": ["55", "44", "11"],
        "BG_HEX": "#372C0B",
        "BE_BLOCK": "minecraft:gold_block",
    },
    "§q": {
        "NAME": ("祖绿", "material_emerald"),
        "RGB": ("17", "160", "54"),
        "HEX": "#47A036",
        "BG_RGB": ["4", "40", "13"],
        "BG_HEX": "#04280D",
        "BE_BLOCK": "minecraft:emerald_block",
    },
    "§s": {
        "NAME": ("钻青", "material_diamond"),
        "RGB": ("44", "186", "168"),
        "HEX": "#2CBAA8",
        "BG_RGB": ["11", "46", "42"],
        "BG_HEX": "#0B2E2A",
        "BE_BLOCK": "minecraft:diamond_block",
    },
    "§t": {
        "NAME": ("染蓝", "material_lapis"),
        "RGB": ("33", "73", "123"),
        "HEX": "#21497B",
        "BG_RGB": ["8", "18", "30"],
        "BG_HEX": "#08121E",
        "BE_BLOCK": "minecraft:lapis_block",
    },
    "§u": {
        "NAME": ("紫色", "material_amethyst"),
        "RGB": ("154", "92", "198"),
        "HEX": "#9A5CC6",
        "BG_RGB": ["38", "23", "49"],
        "BG_HEX": "#261731",
        "BE_BLOCK": "minecraft:amethyst_block",
    },
    "§v": {
        "NAME": ("橙色", "material_resin"),
        "RGB": ("235", "114", "20"),
        "HEX": "#EB7114",
        "BG_RGB": ["59", "29", "5"],
        "BG_HEX": "#3B1D05",
        "BE_BLOCK": "minecraft:resin_block",
    },
}
"""
对于颜色：我的世界格式化代码-基本色彩描述 对照表
"""

MINECRAFT_COLOUR_ANSI = {
    "§0": "\033[0;30m",
    "§1": "\033[0;34m",
    "§2": "\033[0;32m",
    "§3": "\033[0;36m",
    "§4": "\033[0;31m",
    "§5": "\033[0;35m",
    "§6": "\033[0;33m",
    "§7": "\033[0;37m",
    "§8": "\033[0;90m",
    "§9": "\033[0;94m",
    "§a": "\033[0;92m",
    "§b": "\033[0;96m",
    "§c": "\033[0;91m",
    "§d": "\033[0;95m",
    "§e": "\033[0;93m",
    "§f": "\033[0;97m",
    # 从此开始，后是 Java 版不可用的格式化代码
    # 这是我自己编的格式化代码，能看就行
    "§g": "\033[0;38;5;228m",
    "§h": "\033[0;38;5;231m",
    "§i": "\033[0;38;5;254m",
    "§j": "\033[0;38;5;144m",
    "§m": "\033[0;38;5;124m",
    "§n": "\033[0;38;5;130m",
    "§p": "\033[0;38;5;214m",
    "§q": "\033[0;38;5;34m",
    "§s": "\033[0;38;5;44m",
    "§t": "\033[0;38;5;20m",
    "§u": "\033[0;38;5;93m",
    "§v": "\033[0;38;5;214m",
}
"""
对于颜色：我的世界格式化代码-ANSI转义码 对照表
"""


MINECRAFT_FORMAT_MAP = {
    "§k": ("随机", "random"),
    "§l": ("加粗", "bold"),
    # 以下两项并非基岩版可用
    "§m": ("删除线", "strikethrough"),
    "§n": ("下划线", "underline"),
    # 以上 删除线、下划线 基岩版不可用
    "§o": ("斜体", "italic"),
    "§r": ("重置", "reset"),
}
"""
对于文字样式：我的世界格式化代码-描述词 对照表
"""

MINECRAFT_FORMAT_ANSI = {
    "§k": "\033[8m",
    "§l": "\033[1m",
    "§m": "\033[9m",
    "§n": "\033[4m",
    "§o": "\033[3m",
    "§r": "\033[0m",
}
"""
对于文字样式：我的世界格式化代码-ANSI转义码 对照表
"""

MINECRAFT_CODE_ANSI = {
    "§0": "\033[0;30m",
    "§1": "\033[0;34m",
    "§2": "\033[0;32m",
    "§3": "\033[0;36m",
    "§4": "\033[0;31m",
    "§5": "\033[0;35m",
    "§6": "\033[0;33m",
    "§7": "\033[0;37m",
    "§8": "\033[0;90m",
    "§9": "\033[0;94m",
    "§a": "\033[0;92m",
    "§b": "\033[0;96m",
    "§c": "\033[0;91m",
    "§d": "\033[0;95m",
    "§e": "\033[0;93m",
    "§f": "\033[0;97m",
    # 从此开始，后是 Java 版不可用的格式化代码
    # 这是我自己编的格式化代码，能看就行
    "§g": "\033[0;38;5;228m",
    "§h": "\033[0;38;5;231m",
    "§i": "\033[0;38;5;254m",
    "§j": "\033[0;38;5;144m",
    "§m": "\033[0;38;5;124m",
    "§n": "\033[0;38;5;130m",
    "§p": "\033[0;38;5;214m",
    "§q": "\033[0;38;5;34m",
    "§s": "\033[0;38;5;44m",
    "§t": "\033[0;38;5;20m",
    "§u": "\033[0;38;5;93m",
    "§v": "\033[0;38;5;214m",
    # 从此开始是格式部分
    "§k": "\033[8m",
    "§l": "\033[1m",
    "§o": "\033[3m",
    "§r": "\033[0m",
}
"""
我的世界基岩版 完整格式化代码-ANSI转义码 对照表
"""


MINECRAFT_GRAY_BW_COLOUR_LIST = ["§0", "§f", "§7", "§8", "§i", "§j", "§h"]
"""
我的世界灰白黑色的格式化代码
"""

MINECRAFT_NONGRAY_COLOUR_LIST = [
    "§1",
    "§2",
    "§3",
    "§4",
    "§5",
    "§6",
    "§9",
    "§a",
    "§b",
    "§c",
    "§d",
    "§e",
    "§g",
    "§m",
    "§n",
    "§p",
    "§q",
    "§s",
    "§t",
    "§u",
    "§v",
]
"""
非黑白灰的我的世界格式化代码
"""

MINECRAFT_NOTE_INSTRUMENT_COLOUR_MAP = {
    "note.bass": "§1",
    "mob.zombie.wood": "§2",
    "note.bit": "§3",
    "note.bd": "§4",
    "fire.ignite": "§5",
    "note.banjo": "§6",
    "note.pling": "§9",
    "note.basedrum": "§b",
    "note.flute": "§a",
    "note.xylophone": "§c",
    "note.harp": "§d",
    "note.chime": "§e",
    "note.cow_bell": "§g",
    "note.iron_xylophone": "§m",
    "note.snare": "§n",
    "note.hat": "§p",
    "firework.twinkle": "§q",
    "note.didgeridoo": "§s",
    "note.bell": "§t",
    "note.guitar": "§u",
    "firework.blast": "§v",
}
"""
乐器名称-我的世界格式化代码 对照表
"""
